﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage/List2.Master" AutoEventWireup="true" CodeBehind="Org_Company_List.aspx.cs" Inherits="Honestysoft.Baseframework.WebUI.SystemManage.Organization.Org_Company_List"  %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script language="javascript" type="text/javascript">
    //AddType:1.从根节点新增
    //2.从公司类别新增
    //3.从父公司新增
    function openDialog2() {
        var obj = new Object();
        obj.name = "新增子公司";
        var url = '<%=Honestysoft.Baseframework.WebUI.Globals.Home %>' + 'SystemManage/Organization/Org_Company_Edit.aspx?AddType=3&ParentID=<%=Request["CompanyID"]+"" %>&FunctionID=<%=Request["FunctionID"]+"" %>';
        if ('<%=Request["OuType"]+"" %>' == '<%=((int)Honestysoft.Baseframework.Model.EnumItem.OuType.Root_Inner).ToString() %>'
            || '<%=Request["OuType"]+"" %>' == '<%=((int)Honestysoft.Baseframework.Model.EnumItem.OuType.Root_Outer).ToString() %>') {
            url = '<%=Honestysoft.Baseframework.WebUI.Globals.Home %>' + 'SystemManage/Organization/Org_Company_Edit.aspx?AddType=1&OuType=<%=Request["OuType"]+"" %>&FunctionID=<%=Request["FunctionID"]+"" %>';
        }
        else if ('<%=Request["OuType"]+"" %>' == '<%=((int)Honestysoft.Baseframework.Model.EnumItem.OuType.CompanyCategory).ToString() %>') {
            url = '<%=Honestysoft.Baseframework.WebUI.Globals.Home %>' + 'SystemManage/Organization/Org_Company_Edit.aspx?AddType=2&ParentID=<%=Request["ID"]+"" %>&OuType=<%=Request["OuType"]+"" %>&FunctionID=<%=Request["FunctionID"]+"" %>';
        }
        var UrlTmp = escape(url);
        var retValue = window.showModalDialog('<%=Honestysoft.Baseframework.WebUI.Globals.Home %>Scripts/ShowDlg.aspx?url=' + UrlTmp, obj, 'scroll:0;status:0;help:1;resizable:0;dialogWidth:600px;dialogHeight:500px');
        if (typeof (retValue) != "undefined" && retValue != null && retValue) {
            //window.location.href = window.location.href;
            var id = retValue.split('|')[0];
            var text = retValue.split('|')[1];
            //var uri = "SystemManage/Organization/CompanyInfo.aspx?ID=" + id;
            window.parent.addNode(id, text, '<%=((int)Honestysoft.Baseframework.Model.EnumItem.OuType.Company).ToString() %>');
        }
    }
    function openEditDialog(id) {
        var obj = new Object();
        obj.name = "修改公司";
        var url = '<%=Honestysoft.Baseframework.WebUI.Globals.Home %>' + 'SystemManage/Organization/Org_Company_Edit.aspx?ID=' + id + '&FunctionID=<%=Request["FunctionID"]+"" %>';
        var UrlTmp = escape(url);
        var retValue = window.showModalDialog('<%=Honestysoft.Baseframework.WebUI.Globals.Home %>Scripts/ShowDlg.aspx?url=' + UrlTmp, obj, 'scroll:0;status:0;help:1;resizable:0;dialogWidth:600px;dialogHeight:500px');
        if (typeof (retValue) != "undefined" && retValue != null && retValue) {
            window.location.href = window.location.href;
            window.parent.editChildNode(retValue.split('|')[0], retValue.split('|')[1]);
        }
    }
    function checkDelete() {
        if (!getNoSelectionAlert('chkID', '请选择要删除的记录后在执行此操作！')) {
            return false;
        }
        return confirm('删除此公司将同时删除其下面的子公司、部门、人员等信息，是否继续？');
    }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">		
<%if (Request["by"] + "" == "Company")
      { %>
    <ul id="maintab" class="shadetabs">
        <li><a href="CompanyInfo.aspx?ID=<%=Request["CompanyID"] %>&by=Company&FunctionID=<%=Request["FunctionID"] %>" >公司详细信息</a></li>
        <li class="selected"><a href="#default">子公司列表</a></li>
        <li><a href="Org_Department_List.aspx?CompanyID=<%=Request["CompanyID"] %>&by=Company&FunctionID=<%=Request["FunctionID"] %>"  >部门列表</a></li>
        <li><a href="Org_Employee_List.aspx?CompanyID=<%=Request["CompanyID"] %>&by=Company&FunctionID=<%=Request["FunctionID"] %>"  >公司人员列表</a></li>
     </ul>
    <div id="ajaxcontentarea" class="contentstyle">
    <%} %>      
   
    <div class="query_area">
		公司编号：<asp:TextBox ID="txtCompCode" runat="server"  cssClass="input2" MaxLength="200"></asp:TextBox>&nbsp;&nbsp;
		公司全称：<asp:TextBox ID="txtCompName" runat="server"  cssClass="input2" MaxLength="200"></asp:TextBox>&nbsp;&nbsp;		
        <asp:Button runat="server" ID="btnQuery" Text="查 找" CssClass="btn_normal" 
			onMouseOver="this.className='btn_active'" 
            onMouseOut="this.className='btn_normal'" OnClick="btnQuery_Click" />
    </div>            
    <div class="button_area">
        <asp:Button runat="server" ID="btnAdd" CssClass="btn_normal" 
			onMouseOver="this.className='btn_active'" 
            onMouseOut="this.className='btn_normal'" Text="新 增"/>
        <asp:Button runat="server" ID="btnDelete" CssClass="btn_normal" 
			onMouseOver="this.className='btn_active'" 
            onMouseOut="this.className='btn_normal'" Text="删 除" 
            OnClientClick="javascript:return checkDelete();"             
            onclick="btnDelete_Click" />
		<asp:Button runat="server" ID="btnActive" CssClass="btn_normal" 
			onMouseOver="this.className='btn_active'" 
            onMouseOut="this.className='btn_normal'" Text="启 用" 
            OnClientClick="javascript:return getNoSelectionAlert('chkID','请选择要启用的记录后在执行此操作！');"                     
            onclick="btnActive_Click" />
        <asp:Button runat="server" ID="btnCancel" CssClass="btn_normal" 
			onMouseOver="this.className='btn_active'" 
            onMouseOut="this.className='btn_normal'" Text="禁 用" 
            OnClientClick="javascript:return getNoSelectionAlert('chkID','请选择要禁用的记录后在执行此操作！');"                     
            onclick="btnCancel_Click" />
    </div>
    <table cellpadding="0" width="100%" cellspacing="0" border="1" class="t1" id="tGrid">
		<thead>  
            <th align="center" width="30px">
                <input type="checkbox" name="chkAll" value="checkbox" onclick='javascript:checkAll(this,"chkID")' />
            </th>
            <th align="center" width="100px">公司编号</th>
            <th align="center">公司全称</th>      
            <th align="center" width="100px">英文名</th>
            <th align="center" width="80px">联系电话</th>
            <th align="center" width="80px">传真</th>
            <th align="center" width="60px">联系人</th>
            <th align="center" width="40px">是否有效</th>
            <th align="center" width="40px">排序号</th>
            <th width="100px">操作</th>
      	</thead>           
		<asp:Repeater runat="server" ID="rptList">
			<ItemTemplate>
				<tr>
					<td align="center" >
						<input type="checkbox" name="chkID" id="chk<%# DataBinder.Eval(Container.DataItem,"ID") %>"  value="<%# DataBinder.Eval(Container.DataItem,"ID") %>" >
					</td>
					<td><%#  DataBinder.Eval(Container.DataItem,"CompCode") %></td>
                    <td><%#  DataBinder.Eval(Container.DataItem,"CompName") %></td>					
					<td><%#  DataBinder.Eval(Container.DataItem,"CompEName") %></td>
					<td><%#  DataBinder.Eval(Container.DataItem,"Telephone") %></td>
					<td><%#  DataBinder.Eval(Container.DataItem,"Fax") %></td>
					<td><%#  DataBinder.Eval(Container.DataItem,"LinkMan") %></td>
					<td><%# Honestysoft.Baseframework.WebUI.ScriptHelper.Image.GetBooleanImage(DataBinder.Eval(Container.DataItem,"IsValid")) %></td>
					<td><%#  DataBinder.Eval(Container.DataItem,"SortCode") %></td>
					<td>
						<%# GetButtonScript(DataBinder.Eval(Container.DataItem,"ID")+"",Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "IsValid"))) %>
					</td>
				</tr>  
			</ItemTemplate>
		</asp:Repeater>
        <tr>
            <td colspan="10" style="line-height: 28px;text-align:left;">
                <frameworkwebcontrols:aspnetpager id="AspNetPager1" runat="server"
                    alwaysshow="true" firstpagetext="首页" lastpagetext="尾页" nextpagetext="下一页" pageindexboxtype="DropDownList"
                    prevpagetext="上一页" showpageindex="true" showcustominfosection="Right" submitbuttontext="Go"
                    textafterpageindexbox="页" textbeforepageindexbox="转到" currentpagebuttonposition="End"
                    layouttype="Div" custominfotextalign="Right" custominfohtml="共%RecordCount%条记录。第%CurrentPageIndex%页，共%PageCount%页，每页%PageSize%条"
                    direction="LeftToRight" onpagechanged="AspNetPager1_PageChanged">
                </frameworkwebcontrols:aspnetpager>
            </td>
        </tr>
    </table>

    <%if (Request["by"] + "" == "Company")
      { %>

     </div>
    <%} %>      
</asp:Content>